﻿<Window x:Class="MvvmDialogBehaviorSample.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:MvvmDialogBehaviorSample"
        xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
        xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WPF4"
        xmlns:mvvmdialogbehavor="clr-namespace:MvvmDialogBehavior;assembly=MvvmDialogBehavior"
        Title="MainWindow" Height="275" Width="375" Background="Azure">
    <Window.DataContext>
        <local:MainViewModel />
    </Window.DataContext>

    <i:Interaction.Behaviors>
        <mvvmdialogbehavor:DialogBehavior Content="{Binding Dialog}" >
            <!--mvvmdialogbehavor:DialogBehavior.Resources>
                <DataTemplate DataType="{x:Type local:LoginDialogViewModel}">
                    <Grid Height="250" Width="350" Background="Red">
                        <Label Content="LoginDialogView" Height="29" HorizontalAlignment="Left" Name="label1" VerticalAlignment="Top" />
                        <Label Content="UserName" Height="29" HorizontalAlignment="Left" Margin="22,70,0,0" VerticalAlignment="Top" />
                        <Label Content="Password" Height="29" HorizontalAlignment="Left" Margin="22,112,0,0" VerticalAlignment="Top" />
                        <TextBox Text="{Binding UserName}" Height="24" HorizontalAlignment="Left" Margin="96,72,0,0" VerticalAlignment="Top" Width="120" />
                        <TextBox Text="{Binding Password}" Height="24" HorizontalAlignment="Left" Margin="96,114,0,0" VerticalAlignment="Top" Width="120" />
                        <Button Content="Login" Command="{Binding LoginCommand}" Margin="61,157,189,39" />
                        <Button Content="Cancel" Command="{Binding CancelCommand}" Margin="167,157,83,39" />
                    </Grid>
                </DataTemplate>
            </mvvmdialogbehavor:DialogBehavior.Resources-->
            <!--mvvmdialogbehavor:DialogBehavior.Style>
                <Style TargetType="Window">
                    <Setter Property="SizeToContent" Value="WidthAndHeight" />
                    <Setter Property="WindowState" Value="{Binding Path=Content.WindowState, 
                        RelativeSource={RelativeSource Mode=Self}, Mode=TwoWay}"/>
                    <Setter Property="Title" Value="{Binding Path=Content.WindowTitle, 
                        RelativeSource={RelativeSource Mode=Self}}"/>
                </Style>
            </mvvmdialogbehavor:DialogBehavior.Style-->
        </mvvmdialogbehavor:DialogBehavior >

    </i:Interaction.Behaviors>
    
    <Grid>
        
        <!--ContentControl Content="{Binding Dialog}">
            <ContentControl.Resources>
                <DataTemplate DataType="{x:Type local:LoginDialogViewModel}" >
                    <Grid Height="250" Width="350" Background="Ivory">
                        <Label Content="LoginDialogView" Height="29" HorizontalAlignment="Left" Name="label1" VerticalAlignment="Top" />
                        <Label Content="UserName" Height="29" HorizontalAlignment="Left" Margin="22,70,0,0" VerticalAlignment="Top" />
                        <Label Content="Password" Height="29" HorizontalAlignment="Left" Margin="22,112,0,0" VerticalAlignment="Top" />
                        <TextBox Text="{Binding UserName}" Height="24" HorizontalAlignment="Left" Margin="96,72,0,0" VerticalAlignment="Top" Width="120" />
                        <TextBox Text="{Binding Password}" Height="24" HorizontalAlignment="Left" Margin="96,114,0,0" VerticalAlignment="Top" Width="120" />
                        <Button Content="Login" Command="{Binding LoginCommand}" Margin="61,157,189,39" />
                        <Button Content="Cancel" Command="{Binding CancelCommand}" Margin="167,157,83,39" />
                    </Grid>
                </DataTemplate>
            </ContentControl.Resources>
        </ContentControl-->

        <Button Content="Open Dialog" Command="{Binding OpenDialogCommand}" Height="49" HorizontalAlignment="Left" Margin="88,83,0,0" Name="button1" VerticalAlignment="Top" Width="160" />
    </Grid>
</Window>
